home *** CD-ROM | disk | FTP | other *** search
- #ifndef __MESSAGES_CC
- #define __MESSAGES_CC
- #pragma option push -b -a4 -Vx- -Ve- -w-inl -w-aus -w-sig
-
- /***************************************************************************
- *
- * messages.cc - Definitions for the Standard Library messaging facet
- *
- *
- ***************************************************************************
- *
- * (c) Copyright 1994, 1995 Rogue Wave Software, Inc.
- * ALL RIGHTS RESERVED *
- * The software and information contained herein are proprietary to, and
- * comprise valuable trade secrets of, Rogue Wave Software, Inc., which
- * intends to preserve as trade secrets such software and information.
- * This software is furnished pursuant to a written license agreement and
- * may be used, copied, transmitted, and stored only in accordance with
- * the terms of such license and with the inclusion of the above copyright
- * notice. This software and information or any other copies thereof may
- * not be provided or otherwise made available to any other person.
- *
- * Notwithstanding any other lease or license that may pertain to, or
- * accompany the delivery of, this computer software and information, the
- * rights of the Government regarding its use, reproduction and disclosure
- * are as set forth in Section 52.227-19 of the FARS Computer
- * Software-Restricted Rights clause.
- *
- * Use, duplication, or disclosure by the Government is subject to
- * restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
- * Technical Data and Computer Software clause at DFARS 252.227-7013.
- * Contractor/Manufacturer is Rogue Wave Software, Inc.,
- * P.O. Box 2328, Corvallis, Oregon 97339.
- *
- * This computer software and information is distributed with "restricted
- * rights." Use, duplication or disclosure is subject to restrictions as
- * set forth in NASA FAR SUP 18-52.227-79 (April 1985) "Commercial
- * Computer Software-Restricted Rights (April 1985)." If the Clause at
- * 18-52.227-74 "Rights in Data General" is specified in the contract,
- * then the "Alternate III" clause applies.
- *
- **************************************************************************/
-
- #ifndef _RWSTD_NO_NAMESPACE
- namespace std {
- #endif
-
- // ---------------------------------------
- // Facet messages<charT> member templates.
- // ---------------------------------------
-
- template <class charT>
- locale::id messages<charT>::id;
-
- template <class charT>
- messages<charT>::messages (size_t refs):
- locale::facet(refs,locale::messages), __RWSTD::messages_impl("C")
- { }
-
- template <class charT>
- messages<charT>::messages (size_t refs,string name):
- locale::facet(refs,locale::messages), __RWSTD::messages_impl(name)
- { }
-
- template <class charT>
- messages<charT>::~messages() { }
-
- template <class charT>
- messages_base::catalog
- messages<charT>::do_open (const string &cat_name,const locale &loc) const
- {
- return open_cat_(cat_name,loc);
- }
-
- template <class charT>
- _TYPENAME messages<charT>::string_type
- messages<charT>::do_get (messages_base::catalog cat,
- int set,int msgid,const string_type &dflt) const
- {
- char *text=get_mess_(cat,set,msgid);
-
- // The following is wrong -- it should be using codecvt instead of
- // ctype.widen, but this requires an effective codecvt implementation ...
-
- if (text) {
- #ifndef _RWSTD_NO_TEMPLATE_ON_RETURN_TYPE
- return use_facet<ctype<charT> >(get_loc_(cat)).widen(string(text));
- #else
- return use_facet(get_loc_(cat),(ctype<charT>*)0).widen(string(text));
- #endif
- }
- return dflt;
- }
-
- // Specialize member function for char for performance. (Is this really okay
- // without specializing the whole class? Borland fails on it -- if it is in
- // fact legit, we need a config test.)
-
- #if 0
- string messages<char>::do_get
- (messages_base::catalog cat,int set,int msgid,const string &dflt) const
- {
- char *text=get_mess_(cat,set,msgid);
- if (text)
- return text;
- return dflt;
- }
- #endif
-
- template <class charT>
- void messages<charT>::do_close (messages_base::catalog cat) const
- {
- close_cat_(cat);
- }
-
-
- // ----------------------------------------------------------
- // Messages by-name member templates: messages_byname<charT>.
- // ----------------------------------------------------------
-
- template <class charT>
- messages_byname<charT>::messages_byname (const char *name, size_t refs):
- messages<charT>(refs,get_loc_name_(name))
- { }
-
- #ifndef _RWSTD_NO_NAMESPACE
- } // namespace std
- #endif
-
- #pragma option pop
- #endif /* __MESSAGES_CC */
-